import { Image, Space, Button } from 'antd'

export function columns({ handleDelete, handleEdit }) {
  return [{
    key: 'id',
    dataIndex: 'id',
    title: 'id'
  }, {
    key: 'title',
    dataIndex: 'title',
    title: 'title'
  }, {
    key: 'word',
    dataIndex: 'word',
    title: 'word'
  }, {
    key: 'image',
    dataIndex: 'image',
    title: 'image',
    render(image) {
      return <Image src={image} width={50} height={50}></Image>
    }
  }, {
    key: 'price',
    dataIndex: 'price',
    title: 'price'
  }, {
    key: 'datetime',
    dataIndex: 'datetime',
    title: 'datetime'
  }, {
    key: 'opration',
    title: '操作',
    render(row) {
      return <Space>
        <Button type="primary" onClick={() => handleEdit(row)}>编辑</Button>
        <Button type="primary" danger onClick={() => handleDelete(row)}>删除</Button>
      </Space>
    }
  }]
}